home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr45
/
protsbm.zip
/
PROTEU.ZIP
/
PROTCONV.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-02-05
|
1KB
|
63 lines
/* ProtConvert is written by Phil Saunders
ProtConvert expects the following command line:
Convert infile outfile
infile is the file to be converted,
outfile is the converted file,
*/
#include <stdio.h>
main(argc, argv)
int argc;
char *argv[];
{
FILE *infile, *outfile;
int i, j, c, ret;
infile = fopen(argv[1], "r"); /*open Input file*/
if (infile == NULL) {
printf("Couldn't open input file\n");
fclose(infile);
return NULL;
}
outfile = fopen(argv[2], "wb+"); /*open Output file*/
if (outfile == NULL) {
printf("Couldn't open output file\n");
fclose(infile);
fclose(outfile);
return NULL;
}
ret = fseek(infile, 7, 0);
for (j = 1; j < 265; j++) {
for (i = 1; i < 257; i++) {
c = fgetc(infile);
if (c == EOF) {
printf("File too short to retrieve all voices\n");
return EOF;
}
ret = fputc(c, outfile);
if (ret == EOF) {
printf("Error writing output file\n");
return EOF;
}
}
ret = fseek(infile, 9, 1);
}
ret = fclose(infile); /* close files*/
ret = fclose(outfile);
return 0;
}